cursor.addEventListener('compositionend', e =>{ console.log('End composition: %o', e.data); if (!e.data) return; if (mode !== 'normal') return; deleteText(e.data); }); var originalHandleKey = moustrapOnEdit.handleKey; moustrapOnEdit.handleKey = (character, modifiers, e) =>{ _log(`The current mode is ${mode} mode.`); // 文字入力を握りつぶす if (character.match(/^.$/) && mode === 'normal') { e.stopPropagation(); e.preventDefault(); } if (['del','backspace'].includes(character) && mode === 'normal') { e.stopPropagation(); e.preventDefault(); } return originalHandleKey(character, modifiers, e); };